package com.intellij.GraphEditor;

import java.awt.event.MouseMotionListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseEvent;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: karpov
 * Date: 26.11.2006
 * Time: 16:05:35
 * To change this template use File | Settings | File Templates.
 */
public class MyMouseMotionAdapter extends MouseMotionAdapter {
    Editor EditorMotionListener;

    public MyMouseMotionAdapter(Editor editor) {
        this.EditorMotionListener = editor;
    }

    public void mouseMoved(MouseEvent me) {

        //  EditorMotionListener.outpaint(g, me.getX(), me.getY());
        EditorMotionListener.coord.setText("X:" + me.getX() + "  Y:" + me.getY() + "");
        for (int i = 0; i < Editor.vec.size(); i++) {
            Node temp = (Node) Editor.vec.elementAt(i);
            if (me.getX() < temp.coord_x + 10 && me.getX() > temp.coord_x - 10
                    && me.getY() < temp.coord_y + 10 && me.getY() > temp.coord_y - 10) {
                temp.highlight_node();
            } else {
                temp.unhighlight_node();
            }
        }

    }
}
